<?php
defined('IS_OK') or exit('Access Forbidden');
?>
<?php load::into('head'); ?>
<section class="main table">
  <article class="hint">
    <i class="fa fa-info-circle"></i>
    <p>点击“已安装”进行启用或查看本地应用(应用开启导航后，将显示在导航中)，应用文件存在位置“站点根目录/system/plugin/”，应用支持在线购买/安装，如需帮助或应用定制请联系客服！</p>
  </article>
  <div class="market">
    <div class="cut">
      <span>应用分类：</span>
      <ul>
        <li<?php if($G['get']['part']=='plugin'){ ?> class="on"<?php } ?>><a href="<?php echo url::mpf('plugin','plugin','init'); ?>">已安装</a></li>
      </ul>
    </div>
    <div class="filter">
      <dl>
        <dt>搜索：</dt>
        <dd>
          <FORM method="get" action="./">
            <?php echo form::input('lang',$G['get']['lang'],null,'hidden',array(),false); ?>
            <?php echo form::input('mold','plugin',null,'hidden',array(),false); ?>
            <?php echo form::input('part','market',null,'hidden',array(),false); ?>
            <?php echo form::input('func','init',null,'hidden',array(),false); ?>
			      <?php echo form::input('search',$G['get']['search'],null,'text',array('required','placeholder'=>'请输入应用名称搜索')); ?>
            <button class="fa fa-search"></button>
          </FORM>
        </dd>
      </dl>
    </div>
    <div class="list" names="<?php echo $data['names']; ?>" <?php if($data['plugins']){ ?>plugins=<?php echo json::encode($data['plugins']); ?><?php } ?>>
      <table>
        <tbody>
          <tr thead>
            <th>应用名称</th>
            <th>开发商</th>
            <th>版本号</th>
            <th>价格</th>
            <th>导航</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
		      <?php if($data['list']){ ?>
		      <?php foreach($data['list'] as $v){ ?>
          <tr>
            <td>              
              <div class="vimg">
                <img src="<?php echo $v['image']; ?>" alt="<?php echo $v['title']; ?>" />
                <span>
                  <b version="<?php echo $v['version']; ?>" name="<?php echo $v['name']; ?>">
                  <?php if($v['link']){ ?>
                  <a href="<?php echo $v['link']; ?>" target="_blank"><?php echo $v['title']; ?></a>
                  <?php }else echo $v['title']; ?>
                  </b>
                  <p><?php echo $v['description']; ?></p>
                </span>
              </div>
            </td>
            <td width="98"><?php echo $v['author']; ?></td>
            <td width="98"><?php echo $v['version']; ?></td>
            <td width="98" price class="nowrap"></td>
            <td width="98"><?php if(isset($v['display'])) echo form::radio("must",$v['must'],1,$G['option']['open'],array('id'=>$v['id'])); ?></td> 
            <td width="98"><?php if(isset($v['display'])) echo form::radio("display",$v['display'],1,$G['option']['open'],array('id'=>$v['id'],'color'=>'green')); ?></td> 
            <td width="188" operate>
              <?php if($v['id']){ ?>
              <a class="btnfa blue" href="<?php echo url::mpf($v['name'],$v['name'],'init'); ?>" <?php echo $v['target']; ?>>
                <em class="fa fa-pencil" title="管理"></em>
              </a>
              <a class="btnfa red uninstall" url="<?php echo url::mpf($v['name'],'uninstall','init'); ?>">
                <em class="fa fa-trash-o" title="卸载"></em>
              </a>
              <?php }else{ ?>
              <a class="btnfa green" href="<?php echo url::mpf($v['name'],'install','init'); ?>" install="<?php echo $v['name']; ?>">
                <em class="fa fa-cog" title="安装"></em>
              </a>
              <a class="btnfa red delete" url="<?php echo url::mpf('plugin','plugin','delete',array('name'=>$v['name'])); ?>">
                <em class="fa fa-trash-o" title="删除"></em>
              </a>
              <?php } ?>
            </td>
          </tr>
          <?php } ?>
          <?php } ?>
        </tbody>
      </table>
    </div>
    <div class="pages">
      <?php echo html::admpages($data['pages'],$data['total']); ?>
    </div>
  </div>
</section>
<?php load::into('foot'); ?>